首先第一步建立網站的基本架構file
composer create-project laravel/laravel code --prefer-dist
建立檔案成功後先行測試如何連接網頁
/etc/apache2/sites-available/laravel_project.conf
code.dontff.com 子網域
測試時先用自己的IP
|
<VirtualHost *:80> ServerName 192.168.50.111 DocumentRoot "/var/www/code/public" </VirtualHost>
<Directory "/var/www/code"> AllowOverride All Require all granted </Directory> |
以上的曲需要加喺頂頭的位置
sudo systemctl restart apache2
出現了咗這個error
tempnam(): file created in the system's temporary directory
# 修改目录所属用户和组为 www-data
sudo chown -R www-data:www-data storage bootstrap/cache
# 设置正确的目录权限(目录 775,文件 664) sudo find storage bootstrap/cache -type d -exec chmod 775 {} \;
sudo find storage bootstrap/cache -type f -exec chmod 664 {} \;
Illuminate\Database\QueryException
.env
|
DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE= // Your Database Name DB_USERNAME= // Yout Database Username DB_PASSWORD= // Your Database Password
|
成功進入網頁首頁